import 'package:bike_ride/common/util/hysize_fit.dart';
import 'package:bike_ride/res/style/text_styles.dart';
import 'package:bike_ride/router/navigator_util.dart';
import 'package:flutter/material.dart';

/// 沉浸式 页面标题组件
/// 外部用户直接使用Column包裹即可
class PageTitleWidget extends StatelessWidget {
  final String title;

  const PageTitleWidget({super.key, required this.title});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 99.rpx,
      margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
      child: Stack(children: [
        Positioned(
          top: 0,
          left: 0,
          bottom: 0,
          child: BackButton(
            onPressed: () {
              NavigatorUtil.back(context);
            },
          ),
        ),
        Align(
          alignment: Alignment.center,
          child: Text(title,
              style: TextStyles.style_page_title, textAlign: TextAlign.center),
        ),
      ]),
    );
  }
}
